package Review;


public class Test28 {

	public static void main(String[] args) {
		char[] ch ={'a','b','c'};
		permutation(ch);
	}
	public static void permutation(char[] ch)
	{
		if(ch==null||ch.length==0)
			return;
		permutation(ch,0,ch.length-1);
	}
	public static void permutation(char[]ch,int start,int end){
		if(start==end){
			System.out.print(ch);
			System.out.print(" ");
		}
		for(int i=start;i<=end;i++){
			char temp=ch[start];
			ch[start]=ch[i];
			ch[i]= temp;
			permutation(ch,start+1,end);
			temp=ch[start];
			ch[start]=ch[i];
			ch[i]= temp;
		}
	}

}

class Permutation{
	public static void permutation(char []a ){
		if(a == null || a.length <= 0 ){
			return ;
		}
		permutation(a,0,a.length - 1);
	}
	public static void permutation(char []a, int start, int end){
		if(start == end){
			System.out.print(a);
			System.out.println(" ");
		}
		for (int i = start; i <= end; i++) {
			char tmp = a[start];
			a[start] = a[i];
			a[i] = tmp;
			permutation(a,start+1,end);
			a[i] = a[start];
			a[start] = tmp;
		}
	}
}
